using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.Reflection;
using System.IO;

namespace Hack.DllDump
{
    public class Property : IComparable
    {
        protected System.Reflection.PropertyInfo info;

        public Property(System.Reflection.PropertyInfo info)
        {
            this.info = info;
        }

        public void ToString(StringWriter sw)
        {
            sw.Write("{1} {2} {{",
                info.Attributes.ToString(),
                info.PropertyType.Name,
                info.Name);

            if (info.CanRead) sw.Write(" get { }");
            if (info.CanWrite) sw.Write(" set { }");

            sw.Write("}");

        }
        /* 
         * Allow these to be sorted by name
         */
        public int CompareTo(object o)
        {
            Property target = (Property)o;
            return info.Name.CompareTo(target.info.Name);
        }
    }
}
